<template>
	<view class="lowerdetail">
		<view class="lower">
			<view class="lowerTitle">身份类型</view>
			<view class="lowerText">{{lowerinfo.agencyText}}</view>
		</view>
		<view class="lower">
			<view class="lowerTitle">姓名</view>
			<view class="lowerText">{{lowerinfo.realname}}</view>
		</view>
		<view class="lower">
			<view class="lowerTitle">AID</view>
			<view class="lowerText">{{lowerinfo.aid}}</view>
		</view>
		<view class="lower">
			<view class="lowerTitle">手机号</view>
			<view class="lowerText">{{lowerinfo.mobile}}</view>
		</view>
		<view class="lower">
			<view class="lowerTitle">注册时间</view>
			<view class="lowerText">{{lowerinfo.created_at}}</view>
		</view>
	</view>
</template>

<script>
	import { user } from '../../api/index.js'
	export default {
		data() {
			return {
				lowerinfo:{
					agencyText:'',
					realname:'',
					aid:'',
					mobile:'',
					created_at:''
				}
			}
		},
		onLoad:function(data){
			this.userInfo(data.aid);
		},
		methods: {
			async userInfo(aid){
				let that = this;
				console.log(aid)
				let data = await user({id:aid});
				console.log(data);
				if(data.code==0){
					that.lowerinfo.is_agency?that.lowerinfo.agencyText='代理商':that.lowerinfo.agencyText='业务员';
					uni.setNavigationBarTitle({
					    title: that.lowerinfo.agencyText
					});
					that.lowerinfo.realname = data.data.realname;
					that.lowerinfo.aid = data.data.aid;
					that.lowerinfo.mobile = data.data.mobile;
					that.lowerinfo.created_at = data.data.created_at;
				}else{
					alert("获取用户信息失败");
				}
				console.log(data);
			}
		}
	}
</script>

<style lang="scss" scoped>
	.lowerdetail{
		padding: 0 30rpx;
		.lower{
			display: flex;
			font-size: $uni-font-size-base;
			border-bottom: 1rpx $uni-border-color solid;
			padding: 20rpx 0;
			.lowerTitle{
				width: 200rpx;
				color: $uni-text-color-grey;
			}
			.lowerText{
				
			}
		}
	}
</style>
